1. Software and Hardware Overview
1.1 Mind+ Introduction
Mind+ is a youth-oriented programming software developed based on Scratch 3.0. It supports graphical and code-based programming for various open-source hardware platforms such as Arduino, UNIHIKER K10, and UNIHIKER M10. Users can complete programs simply by dragging and dropping blocks, and can also use advanced programming languages such as Python, C, and C++, enabling everyone to easily experience the joy of creation.
Mind+ official website:https://mindplus.cc
1.2 micro:bit Introduction
micro:bit is a microcomputer designed specifically for children’s programming education and for applying technology to solve real-world problems. HUSKYLENS 2 is compatible with micro:bit V2, enabling the development of various interesting visual recognition projects through graphical programming.
micro:bit V2 purchase link: https://www.dfrobot.com/product-2125.html
2. Hardware Connection & Preparation Materials
Preparation Materials
- Hardware
- micro:bit x 1
- HUSKYLENS 2 x 1
- Essential Sensor IO Extender for micro:bit / UNIHIKER M10 / K10 x 1
- USB-C cable for micro:bit x 1
- USB-C cable x 1
- 4-Pin I2C/UART Sensor Cable x 1
Insert the micro:bit into the compatible expansion board. Connect the expansion board to the computer using the USB-C cable. Insert the 4-Pin I2C/UART Sensor Cable into the I2C/UART interface of HUSKYLENS 2, and connect the other end to the "5V Huskylens" port on the expansion board. Since HUSKYLENS 2 has specific power requirements, use an additional USB-C cable to connect to the power port of HUSKYLENS 2, with the other end connected to a computer or compatible power supply.
Refer to the following image for the wiring diagram:
3. Load the HUSKYLENS 2 library
3.1 Load HUSKYLENS 2 Library in MindPlus 2.0
Double-click to open Mind+. After opening, locate "Upload Mode " and click to select it
Wait for the upload mode initialization to complete, click "Extensions" in the lower-left corner. For the first use, you need to download the corresponding main controller extension library. Find "micro:bit" and click the "Download" button in the upper-right corner to download the library.Once the micro:bit expansion pack has finished downloading, click it to load. After successfully loading, it will look like the following image.
Click 'Module ', search for 'HUSKYLENS 2' in the module extensions list, find the HUSKYLENS 2 extension library, and click to download.After successful download, click to load the HUSKYLENS 2 library.
3.2 Load HUSKYLENS 2 Library in MindPlus 1.8 Series
Open the programming software Mind+, click the top-right corner to switch to offline mode. Then click the "Extensions" at the bottom-left corner.
Select the micro:bit as the main controller.
Click ' User-Ext', search for "HUSKYLENS 2" in the search box, press Enter, find the "HUSKYLENS 2" extension library, and click to load the extension library.
The current latest system version is 1.2. Find System Settings > Device Information to check your current system version. We recommend updating to the latest version to experience new features. Update tutorial: Click here
4. Face Recognition Project Example
4.1 Detecting Faces and Outputting Related Data
Under the Face Recognition function, when a face appears on the HUSKYLENS 2 screen, it can be detected and framed. This allows you to obtain data such as the total number of detected faces, the number of learned faces, data of the face closest to the center, data of the n-th face, and data of a face with a specified ID. These data include the face ID, name, center point X/Y coordinates, as well as the width and height of the face.
The example program is shown below.
Align the HUSKYLENS 2 Camera with the face in the scene to perform face learning. For detailed instructions on how to learn faces, please refer to: Face Recognition Function Description — HUSKYLENS 2 WIKI
Upload the program. When one learned face and one unlearned face appear in the scene, the result is shown as follows.
Running Result: As shown below, the serial port outputs the total number of detected faces, the ID of the face closest to the center of the frame, the name of the first detected face, and the total number of learned faces.
There are two faces in the current scene, so the LED matrix displays 2.
4.2 Obtaining Facial Data of a Specified Face
When multiple instances of the same face appear in the frame at the same time, the program can be used to count the number of faces with a specified ID and to obtain the related data of the n-th face with that specified ID.
The example program is shown below.
Running Result: As shown in the figure below, when the program is running and two faces with ID 1 appear in the frame at the same time, the serial port outputs the specified information.
4.3 Face Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of Face Recognition data under the Face Recognition function of HUSKYLENS 2. |
|
Determine if a human face is present in the current frame. |
|
Retrieves data of the face closest to the screen cross cursor, including face ID, custom face name, center X/Y coordinates, width, height, left/right eye X/Y coordinates, left/right mouth corner X/Y coordinates, and nose X/Y coordinates. |
|
Get the total number of faces detected on the screen, including both unregistered and registered faces. |
|
When multiple faces are detected, retrieves data for a specified face. |
|
Get the total number of learned faces detected on the screen. |
|
Determine if a face with the specified ID exists in the frame. Unlearned IDs are uniformly set to 0, and learned IDs are sorted in the order they were learned. |
|
Gets the total number of detected faces with a specified ID on the screen. |
|
Obtain the number of faces with the specified ID in the current frame. |
|
When multiple faces are detected, retrieve the relevant data of a specified face. |
|
Detect the number of faces that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
5. Object Recognition Project Example
5.1 Recognizing Objects and Outputting Related Data
Under the Object Recognition function, HUSKYLENS 2 can acquire object-related data. (which supports recognition of 80 fixed object categories; for details, refer to the HUSKYLENS 2 WIKI.The readable data include: the total number of recognizable objects in the frame, the object closest to the center of the HUSKYLENS 2 camera view, and the ID, name, center point coordinates, width, and height of the N-th detected object.
The example program is shown below.
After the program is successfully uploaded, HUSKYLENS 2 switches to the Object Recognition function. Point the Camera of HUSKYLENS 2 at the objects in the scene and learn them one by one.
After learning is completed, point the camera at the object, and you can observe the output results as below.
Running Result: The corresponding object ID, name, and other data are output as required. If the target object has not been learned, the ID will be 0. When one learned object and one unlearned object appear at the same time, both can be recognized, and the number of recognized objects displayed is 2.
5.2 Obtaining Related Data of a Specified Object
After HUSKYLENS 2 recognizes objects, it can obtain related data of an object with a specified ID in the frame. For example, you can determine whether a specific object appears in the frame, read the name of the specified object, and obtain the number of objects of the same category in the scene. When multiple objects of the same category appear, you can specify and retrieve the related parameters of an object with a designated ID, including its name, X/Y coordinates, width, and height.
The example program is shown below:
Running Result: As shown in the figure, the total number of objects in the frame, the number of objects with ID 1, their name, and the center point coordinates of the first detected object with ID 1 can be obtained.
5.3 Object Recognition Description
| block | Description |
|---|---|
|
Used to obtain one set of object recognition data under the Object Recognition function of HUSKYLENS 2. |
|
Determines whether there are recognizable objects in the current frame. |
|
Obtains data for the object closest to the crosshair on the screen, including object ID, name, center X coordinate, center Y coordinate, width, and height. |
|
Gets the number of all detectable objects in the screen. |
|
When multiple recognizable objects appear,obtains the relevant data of a specified object. |
|
Detect the number of objects that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determines whether an object with a specified ID exists in the frame. (After HUSKYLENS 2 learns objects, it assigns ID numbers according to the learning order.) |
|
Obtains the number of objects with the specified ID in the current frame. |
|
Obtains the related data of a specified object. |
|
When multiple similar objects appear,obtains the related data of a specified object. |
6. Object Tracking Code Example
6.1 Tracking Objects and Outputting Related Data
When HUSKYLENS 2 detects a trackable target object, related tracking data can be obtained. The available data include the object ID, name, center point X/Y coordinates, width, and height.
The example program is shown below.
In Mind+, click Upload to Device and wait for the program upload to complete.
Point the Camera of HUSKYLENS 2 at the object to be tracked (the tracking target must be selected by drawing a bounding box first; for details, refer to the HUSKYLENS 2 WIKI
After the selection is completed, aim the camera at the target object to be tracked and observe the output results.
Running Result: The tracked object’s ID, name, X/Y coordinates, width, and height can be output. The object name is "Object" by default and can be modified.
6.2 Object Tracking Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of Object Tracking data under the Object Tracking function of HUSKYLENS 2. |
|
Determines whether there is a trackable target in the current frame. |
|
Obtains data for the object closest to the crosshair on the screen, including object ID, name, center X coordinate, center Y coordinate, width, and height. |
7. Color Recognition Code Example
7.1 Recognizing Colors and Outputting Related Data
HUSKYLENS 2 can recognize and frame color blocks within its field of view and output related color block data. The readable data include: the total number of detected color blocks, the total number of learned color blocks, as well as the ID, name, center point coordinates, width, and height of the N-th detected color block and the color block closest to the center of the HUSKYLENS 2 camera view.
The example program is shown below.
Upload the program and wait for the upload to complete.
Use the crosshair on HUSKYLENS 2 to align with the color block for learning. For detailed instructions on how to learn colors, please refer to the HUSKYLENS 2 WIKI
After learning is completed, point the Camera of HUSKYLENS 2 at the color block and observe the output results.
Running Result: The total number of detected color blocks can be output. Regardless of whether the color block has been learned, as long as it is framed, it will be counted. The corresponding color block ID and other data can be output as required.
7.2 Obtaining Related Data of a Specified Color
After HUSKYLENS 2 recognizes colors, it can obtain related data of a specified color in the frame. For example, you can determine whether a color block with a specified ID is present in the frame, read the total number of detected color blocks with that ID, and obtain their name. When multiple color blocks with the same ID appear, you can specify and retrieve the related parameters of the N-th color block with the specified ID, including its name, X/Y coordinates, width, and height.
The example program is shown below:
Running Result: As shown in the figure, the total number of color blocks with ID 1 in the frame, the name of the color block with ID 1, and the coordinate position of the first detected color block with ID 1 can be obtained. (The color name can be customized and is "Color" by default.)
7.3 Color Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of color recognition data in the Color Recognition function of HUSKYLENS 2. |
|
Determines whether recognizable color blocks exist in the current frame. |
|
Obtains data for the color block closest to the crosshair on the screen, including ID, name, center X/Y coordinates, width, and height. |
|
Gets the total number of detected color blocks in the screen. |
|
When multiple color blocks are detected, obtaining the data of a specified block. (If the block is unlearned, its ID is 0.) |
|
get the number of colors that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determines whether a color with a specified ID exists in the image. (After HUSKYLENS 2 learns colors, IDs are assigned sequentially.) |
|
Obtains the number of color blocks for a learned color in the current frame.. |
|
Obtains the data of a learned color. |
|
When multiple color blocks of the same color appear,they obtain the data of a specified block. |
8. Self-Learning Classifier Code Example
8.1 Recognizing Learned Objects and Outputting ID and Name
Under the Self-Learning Classifier function, once an object has been learned, HUSKYLENS 2 can recognize it again when it reappears. The following example program can be used to obtain the ID and name of the recognized learned object.
Upload the program and wait for the upload to complete.
After HUSKYLENS 2 finishes learning the object, point the Camera of HUSKYLENS 2 at the learned object and observe the output results. For detailed instructions on how to learn objects, please refer to the HUSKYLENS 2 WIKI
Running Result: As shown below, when a previously learned object appears in the frame, it will be framed and its name, ID, and confidence level will be displayed. If the object name has not been set, the default output name is "Object".
8.2 Object Classification Blocks Description
| block | Description |
|---|---|
|
Under the HUSKYLENS 2 Object Classification function, used to acquire the recognition result of a learned object from one scan. |
|
Judges if a specific learned object has been detected. |
|
Gets data for a specific learned object, including ID and Name. The IDs in Object Classification are pre-assigned in the model, so the user's learning order is not related to the object ID. |
9. Hand Recognition Example Program
9.1 Recognizing Hand Gestures and Outputting Related Data
Under the Hand Recognition function, HUSKYLENS 2 can detect hands in the frame and mark key points. Through the program, gesture-related data can be obtained. The readable data include: whether a hand is present in the current frame, the total number of detected gestures in the frame, the total number of learned gestures, as well as the ID, name, center point coordinates, width, and height of the gesture closest to the center of the HUSKYLENS 2 camera view and the N-th detected gesture.
The example program is shown below.
Upload the program and wait for the upload to complete.
HUSKYLENS 2 enters the Hand Recognition function. Point the Camera of HUSKYLENS 2 at the gestures in the frame to perform learning. For detailed instructions on how to learn gestures, please refer to the HUSKYLENS 2 WIKI
Running Result: When one learned gesture and one unlearned gesture appear in the frame, the total number of detected gestures can be output. Regardless of whether the gesture has been learned, as long as a gesture is detected (i.e., framed), it will be counted. The corresponding gesture ID can be output as required. Learned gestures are assigned IDs in the order of learning, while unlearned gestures have an ID of 0.
9.2 Obtaining Related Data of a Specified Gesture in the Frame
You can determine whether a gesture with a specified ID exists in the frame, and obtain data such as the number of gestures with the specified ID, the name, and the center point coordinates, width, and height of the N-th gesture with that specified ID.
The example program is shown below.
Running Result: As shown in the figure below, when the program is running, the related data of the gesture with ID 1 can be observed in the output.
9.3 Hand Gesture Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of gesture recognition data under the Gesture Recognition function of HUSKYLENS 2. |
|
Determines whether gestures exist in the current frame. |
|
Gets data for the gesture closest to the on-screen crosshair, including Gesture ID, Gesture Name, X/Y coordinates of the gesture's center point, Width, Height, Wrist X/Y coordinates, and the X/Y coordinates for the base, joint, and tip of each finger. |
|
Gets the total number of gestures detected on the screen. |
|
When multiple gestures are detected, obtains the data of a specified gesture. |
|
Get the number of hand gestures that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Obtains the total number of gestures with a specified ID in the current frame. |
|
Obtains data for a gesture with a specified ID. |
|
When multiple gestures share the same ID, obtains the data of a specified gesture. |
|
Determines whether a gesture with the specified ID exists in the image. (After HUSKYLENS 2 learns gestures, IDs are assigned sequentially.) |
10. Instance Segmentation Code Example
10.1 Performing Instance Segmentation and Outputting Related Data
Under the Instance Segmentation function, HUSKYLENS can recognize object categories in the image and mark the contour of each object. Using a program, you can print the total number of recognized instances, the number of learned instances, as well as the name, ID, center point X/Y coordinates, and the width and height of the instance closest to the center and of an instance with a specified ID.
The example program is shown below.
Running Result: After the program is successfully uploaded, HUSKYLENS 2 automatically switches to the Instance Segmentation function. Point HUSKYLENS 2 at the object to be recognized (it must belong to one of the 80 supported categories), and observe the output data such as the number of recognized instances, the ID of a specified instance, and the center point coordinates.HUSKYLENS 2 WIKI.
10.2 Obtaining Related Data of a Specified Instance
Under the Instance Segmentation function, after learning, HUSKYLENS 2 can obtain related data of a specified instance in the frame. For example, you can determine whether a learned instance is present in the frame, read the name of an instance with a specified ID, and obtain the number of instances of the same category. When multiple instances of the same category appear in the frame, you can specify and retrieve the related parameters of a particular instance, including its name, X/Y coordinates, width, and height.
The example program is shown below.
Running Result: After the program is successfully uploaded, HUSKYLENS 2 automatically switches to the Instance Segmentation function. When multiple instances of the same category appear in the frame, the number of instances of that category can be recognized, and the center point coordinate data of the first instance with ID 1 is output.
10.3 Instance Segmentation Blocks Description
| block | Description |
|---|---|
|
Acquire tag instance segmentation data once. |
|
Determine if an instance is present in the current frame. |
|
Obtain relevant data of the instance nearest to the screen crosshair, including the instancee's ID, name, center X coordinate, center Y coordinate, width, and height. |
|
Get the total number of instances detected on the screen, including both unregistered and registered instances. |
|
Obtain the relevant data of a specified instance when multiple instances appear. |
|
Get the number of instances that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determine if an instance with the specified ID exists in the frame. Unlearned IDs are uniformly set to 0, and learned IDs are sorted in the order they were learned. |
|
Get the number of instances with a specified ID. |
|
Obtain the number of instances with the specified ID in the current frame. |
|
When multiple instances are detected, retrieve the relevant data of a specified instance. |
11. Pose Recognition Example
11.1 Recognizing Human Poses and Outputting Related Data
Under the Pose Recognition function, HUSKYLENS 2 can recognize human bodies appearing in the frame and mark key body points. Through the program, the following data can be read: whether a human body is detected, the total number of detected human bodies, the total number of learned human bodies, as well as the ID, name, center point coordinates, width, and height of the N-th detected human body and the human body closest to the center of the frame.
The example program is shown below.
Upload the program. After the program is successfully uploaded, HUSKYLENS 2 enters the Pose Recognition function. Point the Camera of HUSKYLENS 2 at the human pose in the frame to perform learning. For detailed instructions on how to learn poses, please refer to the HUSKYLENS 2 WIKI
Running Result: When one learned pose and one unlearned pose appear in the frame, the total number of detected human bodies can be output. The ID of a specified human pose can also be output. Learned poses are assigned IDs in the order of learning, while unlearned poses have an ID of 0.
11.2 Obtaining Data of a Specified Pose
When multiple poses with the same ID appear in the frame, the related data of a specified pose can be obtained. For example, you can determine whether a pose with a specified ID is present in the frame, obtain the number of poses with the same ID in the frame, and when multiple identical poses appear, specify and retrieve the related data of the N-th pose with that specified ID, including its name, X/Y coordinates, width, and height.
The example program is shown below:
Running Result: As shown in the figure, the number of poses with ID 1 in the frame, their name, and the coordinate position of the first detected pose with ID 1 can be obtained.
11.3 Pose Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of pose recognition data under the Pose Recognition function of HUSKYLENS 2. |
|
Determines whether human bodies exist in the current frame. |
|
Get the related data of the human posture closest to the crosshair on the screen, including: Human posture ID, Human posture name, X coordinate of the center of the human posture, Y coordinate of the center of the human posture, Width, Height, X/Y coordinates of both eyes, ears, and nose, X/Y coordinates of both shoulders, elbows, wrists, hips, knees, and ankles. |
|
Gets the total number of detected human bodies on the screen. |
|
When multiple human bodies appear, obtain the data of a specified body by index. |
|
Detect the number of poses that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determines whether a learned pose with a specified ID exists in the image. (After HUSKYLENS 2 learns poses, IDs are assigned sequentially.) |
|
Obtains the number of learned poses with a specified ID in the current frame. |
|
Obtains the data of a learned pose with a specified ID. |
|
When multiple identical learned poses appear, obtain the data of a specified one by index. |
12. License Recognition Example
12.1 Recognizing License Plates and Outputting Related Data
Under the License Recognition function, when a license plate appears on the HUSKYLENS 2 screen, it can be recognized and framed, and related license plate data can be obtained. The readable data include: the ID and name of the specified license plate, the license plate content (plate number), width, height, the X and Y coordinates of the license plate center point, and the total number of license plates in the frame.
The example program is shown below.
Upload the program and wait for the upload to complete.
Point the Camera of HUSKYLENS 2 at the license plate in the frame to perform learning. For detailed instructions on how to learn license plates, please refer to the HUSKYLENS 2 WIKI
Point the Camera of HUSKYLENS 2 at the license plate and observe the output data.
Running Result: As shown below, if the specified license plate has not been learned, its ID is 0. If the specified license plate has been learned, its corresponding ID is output.
12.2 Outputting Data of a License Plate with a Specified ID
When multiple license plates with the same ID appear in the frame, the following example program can be used to collect and output the related data of license plates with that ID in the frame.
Running Result: As shown below, when multiple license plates with a specified ID appear in the frame, the total number of license plates with that ID in the frame, the plate number of the specified license plate under that ID, and the license plate coordinates can be obtained.
12.3 License Plate Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of license recognition data under the License Recognition function of HUSKYLENS 2. |
|
Determines whether a license plate exists in the current frame. |
|
Obtains data of the license closest to the crosshair, including ID, name, center X/Y coordinates, width, height, and decoded content. |
|
Gets the total number of detected licenses (both learned and unlearned). |
|
When multiple licenses are detected, obtains data for a specified license.. |
|
Get the number of license plates that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determines whether a license with the specified ID exists in the frame. Unlearned licenses have ID=0, learned IDs follow learning order. |
|
Obtains the number of licenses with a specified ID in the frame. |
|
Obtains data for a specified license in the frame. |
|
When multiple licenses share the same ID, obtains data for a specified license. |
13. Optical Char Recognition Example
13.1 Recognizing Text and Outputting Related Data
Under the Optical Char Recognition function, HUSKYLENS 2 can recognize and frame text blocks within its field of view and display the recognized text on the screen. Using the following example program, you can count the total number of recognizable text blocks in the frame and obtain related data of the text block closest to the crosshair. The readable data include: the text block ID, name, content, center point X/Y coordinates, as well as the width and height of the text block.
The example program is shown below.
Upload the program and wait for the upload to complete.
Align the crosshair on the HUSKYLENS 2 screen with any optical characters to learn a text block. For detailed instructions on how to learn optical characters, please refer to the HUSKYLENS 2 WIKI
Running Result: As shown below, the total number of text blocks in the frame can be counted, and the text block indicated by the crosshair is recognized and its related data are output.
Note: Under the Optical Char Recognition function, HUSKYLENS 2 can detect all text block regions in the frame and mark them with bounding boxes. However, only the content of the single text block located at the crosshair position is recognized, and the recognized text is displayed at the upper-left corner of the bounding box.
13.2 Optical Char Recognition Blocks Description
| block | Description |
|---|---|
|
Used to acquire char recognition data once under HUSKYLENS 2 Optical Char Recognition. |
|
Determine whether any text is detected in the current screen. |
|
Get data of the text block nearest to the crosshair, including ID, name, center X/Y coordinates, width, and height. |
|
Get the total number of detected text areas on screen. |
|
When multiple text blocks are detected, get related data of a specified text block. |
|
Get the number of text blocks with a specified ID. |
|
Get data of a specific text block by its ID. |
|
When multiple identical text blocks appear, get related data of one specified text block. |
|
Determine whether a text block with a specified ID exists in the screen. |
|
Get the number of text areas that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
14. Line Tracking Code Example
Under the Line Tracking function, HUSKYLENS 2 can mark the trajectory of the line in the frame and obtain the current line length, angle, and X/Y components. When branches appear on the line, it can also obtain the number of branches at the intersection and the corresponding data of each branch in a counterclockwise order.
The example program is shown below.
The displayed line length and angle are the results calculated through geometric computation after the line is mapped onto the HUSKYLENS 2 screen.
Next, the calculation methods for the X/Y components, angle, and length read in Line Tracking are explained:
As shown in the figure below, the black line recognized in Line Tracking is used as an example.
Angle:
The angle between the straight line formed by the line start point and end point and the X-axis corresponds to the “Angle” value read in Line Tracking. The angle range is -90 to 90, where clockwise is a positive value and counterclockwise is a negative value.
Length:
The straight-line distance from the line start point to the end point corresponds to the “Length” value read in Line Tracking.
X Component:
The straight-line distance from the line start point to the center of the HUSKYLENS 2 screen (coordinates [320, 480]) is the X component value. If the direction from the start point to the screen center is to the right, the X component is positive; if to the left, the X component is negative.
Y Component:
The vertical distance from the line end point to the X-axis is the Y component value.
14.2 Line Tracking Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of Line Tracking data under the Line Tracking function of HUSKYLENS 2. |
|
Determines whether lines exist in the current frame. |
|
Obtains data for the line closest to the crosshair, including X component,Y component,angle,length. |
|
Gets the total number of detected lines on the screen. |
|
When multiple lines appear, obtaining datas of a specified branch. |
15. Face Emotion Recognition Code Example
15.1 Recognizing Facial Emotions and Outputting Related Data
Under the Face Emotion Recognition function, HUSKYLENS 2 can recognize seven predefined facial emotions: Anger (ID 1), Disgust (ID 2), Fear (ID 3), Happiness (ID 4), Neutral (ID 5), Sadness (ID 6), and Surprise (ID 7). These emotions are pre-trained at the factory on HUSKYLENS 2 and do not require users to perform additional manual learning. For detailed instructions on using the Face Emotion Recognition function, please refer to the HUSKYLENS 2 WIKI
Using the following example program, you can count the total number of facial emotions recognized in the current HUSKYLENS 2 camera frame and output data such as the ID, quantity, name, center point coordinates, width, and height of a specified facial emotion.
The example program is shown below.
Upload the program and wait for the upload to complete.
When any of the seven facial emotions listed above appear in the camera view, observe that the HUSKYLENS 2 screen frames the face and displays the emotion ID, name, and confidence.
Running Result: As shown below, you can observe and count the total number of facial emotions in the current frame, as well as the related data of a facial emotion with a specified ID.
15.2 Obtaining Related Data of a Specified Facial Emotion in the Frame
When multiple facial emotions with the same ID appear in the frame, the following example program can be used to collect and output the related data of facial emotions with that ID in the frame.
Running Result: As shown below, when multiple facial emotions with a specified ID appear in the frame, you can obtain data such as the total number of facial emotions with that ID in the frame, their name, and the coordinates of a specified facial emotion under that ID.
15.3 Face Emotion Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain expression recognition data once under HUSKYLENS 2 Face Emotion Recognition. |
|
Determine whether the current image contains seven specific expressions (anger (ID 1), disgust (ID 2), fear (ID 3), happiness (ID 4), neutral (ID 5), sadness (ID 6), and surprise (ID 7)). |
|
Get data of the expression closest to the crosshair: ID, name, center X/Y coordinates, width, and height. |
|
Get the total number of detected expressions. |
|
Get the related data of a specified expression when multiple expressions are detected. |
|
Get the total number of learned expressions that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determine whether an expression with a specified ID is present (anger (ID 1), disgust (ID 2), fear (ID 3), happiness (ID 4), neutral (ID 5), sadness (ID 6), and surprise (ID 7)). |
|
Get the number of expressions with a specified ID. |
|
Get the related data of an expression by its ID. |
|
Get the related data of one specific expression when multiple identical expressions appear. |
6. Tag Recognition Code Example
16.1 Recognizing Tags and Outputting Related Data
HUSKYLENS 2 can recognize AprilTag labels appearing in the frame. Through programming, you can obtain related data of the detected tags in the frame. The readable tag data include: data of a specified tag, such as the tag ID, tag content, tag width, tag height, and the X/Y coordinates of the tag center point, as well as the total number of detected tags.
The example program is shown below.
Upload the program and wait for the upload to complete.
Point the Camera of HUSKYLENS 2 at the tag in the frame to perform learning. For detailed instructions on how to learn tags, please refer to the HUSKYLENS 2 WIKI
Point the Camera of HUSKYLENS 2 at the tag and observe the output results.
Running Result: As shown in the figure, the total number of detected tags can be output (regardless of whether the tag has been learned). The specified tag ID can also be output; for an unlearned tag, the ID is 0.
16.2 Obtaining Related Data of a Specified Tag in the Frame
After HUSKYLENS 2 recognizes tags, it can obtain related data of a specified tag in the frame. For example, you can determine whether a tag with a specified ID is present in the frame, obtain the number of tags with the same ID in the frame, and when multiple tags with the same ID appear, specify and retrieve the related parameters of a particular tag, including its name, content, X/Y coordinates, width, and height.
The example program is shown below:
Running Result: As shown in the figure, when there are two learned tags with ID 7 in the frame, the related data of one specified tag can be output.
16.3 Tag Reconition Blocks Description
| block | Description |
|---|---|
|
Acquire tag recognition data once. |
|
Determine if any tag is detected. |
|
Get data of tag closest to crosshair: ID, center X/Y coordinates, width, height, decoded content. |
|
Get total number of detected tags,including both unlearned and learned labels.. |
|
Get data of a specified tag. |
|
Get total number of learned tags that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determine whether a tag with the specified ID exists.The IDs of unlearned tags are all set to 0, and the IDs of learned tags are sorted in the order in which they were learned. |
|
Get the number of tags with a specified ID. |
|
Get data of a specified ID tag. |
|
Get data of a specified one when multiple tags share the same ID. |
17. QR Code Recognition Blocks
17.1 Recognizing QR Codes and Outputting Related Data
HUSKYLENS 2 can recognize QR codes appearing in the frame. Through programming, you can obtain related data of the detected QR codes in the frame. The readable QR code data include: the total number of detected QR codes, and data of a specified QR code, including its ID, content, width, height, and the X/Y coordinates of the QR code center point.
The example program is shown below.
Upload the program and wait for the upload to complete.
Point the Camera of HUSKYLENS 2 at the QR code in the frame to perform learning. For detailed instructions on how to learn QR codes, please refer to the HUSKYLENS 2 WIKI
Point the Camera of HUSKYLENS 2 at the QR code and observe the output results.
Running Result: As shown in the figure, the total number of detected QR codes can be output (regardless of whether the QR code has been learned). The specified QR code ID can also be output; for an unlearned QR code, the ID is 0.
17.2 Obtaining Related Data of a Specified QR Code in the Frame
After HUSKYLENS 2 recognizes QR codes, it can obtain related data of a specified QR code in the frame. For example, you can determine whether a QR code with a specified ID is present in the frame, obtain the number of QR codes with the same ID in the frame, and when multiple QR codes with the same ID appear, specify and retrieve the related parameters of a particular QR code, including its name, content, X/Y coordinates, width, and height.
The example program is shown below.
As shown in the figure, the QR code previously learned by Liang Ge has the content "2025", and the center point coordinates of the first detected QR code are (171, 218).
17.3 QR Reconition Blocks Description
| block | Description |
|---|---|
|
Acquire QR code recognition data once. |
|
Determine if any tag is detected. |
|
Get data of the closest QR code: ID, name, center X/Y coordinates, width, height, decoded content. |
|
Get total number of detected QR codes, including unlearned and learned QR codes. |
|
Get the number of QR codes that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Get data of a specified QR code. |
|
Determine whether a specified ID exists. |
|
Get number of QR codes with a specified ID. |
|
Get data of QR codes with a specified ID. |
|
Get data of one specified QR code when multiple shares the same ID. |
18. Barcode Recognition Blocks
18.1 Recognizing Barcodes and Outputting Related Data
HUSKYLENS 2 can recognize barcodes appearing in the frame. Through programming, you can obtain related data of the detected barcodes in the frame. The readable barcode data include: the total number of detected barcodes, and data of a specified barcode, including its ID, content, width, height, and the X/Y coordinates of the barcode center point.
The example program is shown below.
Upload the program and wait for the upload to complete. Point the Camera of HUSKYLENS 2 at the barcode in the frame to perform learning. For detailed instructions on how to learn barcodes, please refer to the HUSKYLENS 2 WIKI
Point the Camera of HUSKYLENS 2 at the barcode and observe the results displayed on the UNIHIKER K10 screen.
Running Result: As shown in the figure, the total number of detected barcodes can be output (regardless of whether the barcode has been learned). The specified barcode ID can also be output; for an unlearned barcode, the ID is 0.
18.2 Barcode Blocks Description
| block | Description |
|---|---|
|
Retrieve barcode recognition data once. |
|
Determine whether any barcode is detected. |
|
Get data of the barcode closest to the crosshair: ID, name, center X/Y coordinates, width, height, decoded content.. |
|
Get the total number of detected barcodes, including learned and unlearned. |
|
Get data of a specified barcode when multiple are detected. |
|
Get the total number of barcodes that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determine whether a barcode with a specified ID exists. (ID=0 for unlearned). |
|
Get the number of barcodes with the specified ID. |
|
Get related data of barcodes with the specified ID. |
|
When multiple barcodes share the same ID, get related data for one of them. |